package com.sskj.xgja.mine;

import com.sskj.base.data.User;
import com.sskj.base.utils.RxUtils;
import com.sskj.xgja.BasePresenter;
import com.sskj.xgja.api.Api;
import com.sskj.xgja.api.ApiObserver;
import com.sskj.xgja.mine.data.AppVersionBean;


/**
 * @author Hey
 * Create at  2019/03/20
 */
class SettingActivityPresenter extends BasePresenter<SettingActivity> {

    public void checkVersion(String versionName) {
        Api.getInstance().checkVersion(1, versionName)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<AppVersionBean>(this) {
                    @Override
                    public void onSuccess(AppVersionBean data) {
                        mView.checkVersion(data);
                    }

                });
    }
    public void getAccountDetail() {
        Api.getInstance().accountDetail()
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<User>(this, false) {
                    @Override
                    public void onSuccess(User data) {
                        mView.setAccountInfo(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                });
    }
}
